UMBC High Performance Computing Facility : Running IDL on HPC
This page last changed on Mar 11, 2009 by straha1.
Performing Calculations on the Cluster NodesRunning IDL on the cluster is not much different than running Matlab or other serial programs as long as you're not making plots (we'll cover that in the next section). There are a few minor modifications you must make to your qsub script. First, we'll need an example IDL program. Here is sayhello.pro: ; sayhello.pro pro sayhello,what print,'HELLO ',what end and also, main.pro: ; main.pro pro main sayhello,'WORLD' end Next you'll need a qsub script which we'll call sayhello.qsub: #!/bin/bash : The above line tells Linux to use the shell /bin/bash to execute : this script. That must be the first line in the script. : You must have no lines beginning with # before these : PBS lines other than the /bin/bash line: #PBS -N 'hello_parallel' #PBS -o 'qsub.out' #PBS -e 'qsub.err' #PBS -W umask=007 #PBS -q low_priority #PBS -l nodes=1:ppn=4 #PBS -m bea : Change the current working directory to the directory from which you ran qsub: cd $PBS_O_WORKDIR : Run IDL and tell it to execute the "main" procedure: idl -e main If you want details on what that qsub script does and what each line means, then see this page. Note that we're using all four processors on one machine (nodes=1:ppn=4). That is because IDL automatically uses all processors on a machine. If you don't allocate all four processors, you'll end up sharing the machine with someone, and taking up some of their CPU time. Now run qsub to submit that job: qsub sayhello.qsub Eventually the job will complete. You can monitor it before it completes using qstat. When it does complete, it will create qsub.out and qsub.err files. The qsub.out file should contain: HELLO WORLD and the qsub.err file should contain: IDL Version 7.0 (linux x86_64 m64). (c) 2007, ITT Visual Information Solutions Installation number: XXXXXX-X. Licensed for use by: University of Maryland % Compiled module: MAIN. % Compiled module: SAYHELLO. Generating Plots on the Cluster NodesGenerating plots without a desktop on IDL can be complicated if you don't have functions that automate everything for you. A popular pair is plopen and plclose, developed at Goddard. For this tutorial, we will use imopen and imclose which are simply modified versions of Goddard's plopen and plclose with support for additional image types: Copy those to a directory on hpc and then create this file, testplot.pro in the same directory: pro testplot ; Generate a thousand numbers from 0 to 2*pi: zero_to_2pi=indgen(1001)/500.0*!pi ; Calculate the sine of each of the list of numbers: sine=sin(zero_to_2pi) ; Tell imopen to open a portable network graphics ("png") file "test.png": imopen,'png',fn='test' ; The 'png' tells imopen the file format. The fn='test' tells imopen the ; file's basename -- the portion of the filename that comes before the last '.' ; Later, when you call imclose, imclose will generate the file "test.png". ; It makes that filename by appending a "." and the name of the file format ; ("png") to the end of your file's basename ("test" from fn='test'). ; Plot sin(x) with x=0..2*pi: plot,zero_to_2pi,sine ; Tell imclose to copy everything we plotted between imopen and ; imclose to the test.png file and close that file: imclose end Then create a new qsub script: #!/bin/bash : The above line tells Linux to use the shell /bin/bash to execute : this script. That must be the first line in the script. : You must have no lines beginning with # before these : PBS lines other than the /bin/bash line: #PBS -N 'hello_parallel' #PBS -o 'qsub.out' #PBS -e 'qsub.err' #PBS -W umask=007 #PBS -q low_priority #PBS -l nodes=1:ppn=4 #PBS -m bea : Change the current working directory to the directory from which you ran qsub: cd $PBS_O_WORKDIR : Run IDL and tell it to execute the "testplot" procedure: idl -e testplot Note that all we've changed is that "main" has been replaced with "testplot". Now submit that script using qsub: qsub testplot.qsub When the job finishes, it should create qsub.out, qsub.err and test.png. The qsub.err file should contain: IDL Version 7.0 (linux x86_64 m64). (c) 2007, ITT Visual Information Solutions Installation number: XXXXXX-X. Licensed for use by: University of Maryland % Compiled module: TESTPLOT. % Compiled module: IMOPEN. % Compiled module: IMCLOSE. % Loaded DLM: PNG. The qsub.out file should be empty and the test.png image should look like this: Any of the 2D IDL plotting routines should work. The visualization routines that rely on fancy 3D X11 applications will not work since they require an actual graphical display. |
Document generated by Confluence on Mar 31, 2011 15:37 |